/*菜单api*/

import request from '@/utils/request'

// 菜单分页
export function rolePage(params) {
  return request({
    url: '/role/page',
    method: 'get',
    params: params
  });
}


// 查询所以未被禁用的角色数据
export function roleList(userId) {
  let data = {
    "userId":userId
  };
  return request({
    url: '/role/list',
    method: 'get',
    params:data
  });
}

// 获取角色下对应的所有菜单
export function roleMenu(params) {
  let data = {
    "roleId":String(params)
  };
  return request({
    url: '/role/roleMenu',
    method: 'get',
    params: data
  });
}

  // 角色绑定菜单
 export function bindMenu(arr,roleId) {
    let data = {
      "roleId":roleId,
      "menuList":arr
    };
    return request({
      url: '/role/bindMenu',
      method: 'post',
      data
    });
}


// 新增/修改角色
export function saveOrUpdate(obj) {
  let data = {
    "roleName":obj.roleName,
    "summary":obj.summary,
    "id":obj.id
  };
  return request({
    url: '/role/saveOrUpdate',
    method: 'post',
    data
  });
}


// 获取所有违背删除的角色信息
export function allRoleList() {
  return request({
    url: '/role/roleList',
    method: 'get'
  });
}

